package com.arvato.wxwork.service.dictionary;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.arvato.minipro.bean.bean_dto.common.PageData;
import com.arvato.minipro.bean.bean_dto.common.Query;
import com.arvato.wxwork.bean.bean_do.dictionary.WxworkDictionaryMenuDo;
import com.arvato.wxwork.bean.bean_vo.dictionary.WxworkDictionaryMenuVo;
import com.arvato.wxwork.mapper.dictionary.WxworkDictionaryMenuMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;


@Service
@Transactional
public class WxworkDictionaryMenuService {
	
	@Autowired
	private WxworkDictionaryMenuMapper wxworkDictionaryMenuMapper;
	
	/**
	 * 批量查询内容词典菜单项
	 * @param query
	 * @param pageNum
	 * @param pageSize
	 * @return
	 */
	public PageData listDictionaryMenuByQuery(Query query, Integer pageNum, Integer pageSize) {
		PageHelper.startPage(pageNum, pageSize);
		List<WxworkDictionaryMenuVo> dictionaryMenuList = wxworkDictionaryMenuMapper.listDictionaryMenuByQuery(query);
		PageInfo<WxworkDictionaryMenuVo> pageInfo = new PageInfo<WxworkDictionaryMenuVo>(dictionaryMenuList);
		return new PageData(pageInfo.getTotal(), pageInfo.getList());
	}
	
	/**
	 * 根据Id查询内容词典菜单项
	 * @param DictionaryMenuId
	 */
	public WxworkDictionaryMenuVo getDictionaryMenuById(String id) {
		return wxworkDictionaryMenuMapper.getDictionaryMenuById(id);
	}
	
	/**
	 * 新增一个内容词典菜单项
	 * @param DictionaryMenuDo
	 * @return
	 */
	public int insert(WxworkDictionaryMenuDo dictionaryMenuDo) {
		return wxworkDictionaryMenuMapper.insert(dictionaryMenuDo);
	}
	
	/**
	 * 修改一个内容词典菜单项
	 * @param DictionaryMenuDo
	 * @return
	 */
	public int update(WxworkDictionaryMenuDo dictionaryMenuDo) {
		int row = wxworkDictionaryMenuMapper.update(dictionaryMenuDo);
		return row;
	}
	/**
	 * 删除一个内容词典菜单项
	 * @param DictionaryMenuId
	 * @return
	 */
	public int delete(String id) {
		int row = wxworkDictionaryMenuMapper.delete(id);
		return row;
	}
	
}
